package com.yunchao.feature.business.data.datasource.database.model

import com.yunchao.feature.business.domain.model.BusinessPackModel
import com.yunchao.library.lock.getLockEPCInfo


internal data class BusinessPackEntityModel(
    val voucherTypeName: String,//  String 15 N  券别名称
    val value: String,//  String 10 N  面额
    val paperTypeID: String,//  String 1  N  券别说明ID
    val paperTypeName: String,//    String 15 N  券别说明名称
    val sackMoney: String,//String  18,2   N  封装金额
    val sackNo: String,//String 50 N  锁条号
    val voucherTypeId: String,//    String 6  N  券别ID
    val bundles: String,//  String 2  N  捆数
    val tie: String,//  String 3  N  把数
    val oprDT: String,//    String 14 N  封装时间
    val totalMoney: String,//   String 18,2   N  总金额
    val mustOutFlag: String,//String   1  N  是否必出箱
    val handleResult: Boolean = false,
    val lockEPC: String? = null,

    val currency: String,
    val condomId: String,
    val condomName: String,
    val editionId: String,
    val editionName: String,
    val number: String,
    val flag: String,
    val scanResult: String
)

internal fun BusinessPackEntityModel.toDomainModel() = BusinessPackModel(
    voucherTypeName = voucherTypeName,
    value = value,
    paperTypeID = paperTypeID,
    paperTypeName = paperTypeName,
    sackMoney = sackMoney,
    sackNo = sackNo,
    voucherTypeId = voucherTypeId,
    bundles = bundles,
    tie = tie,
    oprDT = oprDT,
    totalMoney = totalMoney,
    mustOutFlag = mustOutFlag,
    handleResult = handleResult,
    lockEPCInfo = lockEPC?.let { getLockEPCInfo(it) },
    currency = currency,
    condomId = condomId,
    condomName = condomName,
    editionId = editionId,
    editionName = editionName,
    number = number,
    flag = flag,
    scanResult = scanResult
)